//
//  ListCollectionViewCell.m
//  UI-21-豆豆豆瓣
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 Wang Hao. All rights reserved.
//

#import "ListCollectionViewCell.h"
#import "UIImageView+WebCache.h"

@implementation ListCollectionViewCell

- (void)dealloc
{
    [_headImageView release];
    [_nameLabel release];
    [_movie release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        
        [self createSubs];
        
    }
    return self;
}
-(void)createSubs{
    
    
    
    self.headImageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    self.headImageView.backgroundColor = [UIColor yellowColor];
    self.headImageView.userInteractionEnabled = YES;
    [self.contentView addSubview:self.headImageView];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height-10, self.contentView.frame.size.width, 40)];
    self.nameLabel.text = @"";
    self.nameLabel.font = [UIFont systemFontOfSize:15];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.nameLabel];
    [_nameLabel release];
    
    
    
}

-(void)setMovie:(Movie *)movie{
    
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    
    self.nameLabel.text = self.movie.movieName;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:self.movie.pic_url] placeholderImage:[UIImage imageNamed:@"movie"]];
    
}




@end
